package y23.Oct;

import java.util.Scanner;

public class Test27 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str1 = in.nextLine();
        String str2 = in.nextLine();
        int count = 0;
        int maxCount = 0;
        for (int i = 0; i < str1.length(); i++) {
            for (int j = 0; j < str2.length(); j++) {
                if (maxCount > str2.length()-j){
                    break;
                }
                if(str1.charAt(i) == str2.charAt(j)){
                    for (int k = 0;( k+i < str1.length() && k+j < str2.length()); k++) {
                        if(str1.charAt(i+k)==str2.charAt(j+k)){
                            count++;
                        }else {
                            maxCount = Math.max(maxCount,count);
                            count = 0;
                            j+=k;
                            break;
                        }
                    }
                }
            }
            if (maxCount > str1.length()-i){
                break;
            }
        }
        System.out.println(maxCount);
    }
}
